
<div>
  <h1><%= @brand.new_record? ? "新建品牌" : "修改品牌 ##{params[:id]}" %></h1>
</div>

<div class="form-body">
  <%= form_for @brand,
    url: (@brand.new_record? ? admin_brands_path : admin_brand_path(@brand)),
    method: (@brand.new_record? ? 'post' : 'put'),
    html: { class: 'form-horizontal' } do |f| %>

    <% unless @brand.errors.blank? %>
      <div class="alert alert-danger">
        <ul class="list-unstyled">
          <% @brand.errors.messages.values.flatten.each do |error| %>
            <li><i class="fa fa-exclamation-circle"></i> <%= error %></li>
          <% end -%>
        </ul>
      </div>
    <% end -%>

    <div class="form-group">
      <label for="name" class="col-sm-2 control-label">品牌名*:</label>
      <div class="col-sm-5">
        <%= f.text_field :title, class: "form-control", id: 'title' %>
      </div>
    </div>

    <div class="form-group">
      <div class="col-sm-offset-2 col-sm-8">
        <%= f.submit (@brand.new_record? ? "新建品牌" : "编辑品牌"), class: "btn btn-primary" %>
      </div>
    </div>

  <% end -%>
</div>

